home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Harvest C / MPW Int & Lib / Interfaces / Processes.h < prev    next >
Text File  |  1991-04-17  |  5KB  |  187 lines

  1. /************************************************************
  2.  
  3. Created: Sunday, January 6, 1991 at 9:42 PM
  4.     Processes.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc.    1989-1990
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PROCESSES__
  15. #define __PROCESSES__
  16.  
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21. #ifndef __EVENTS__
  22. #include <Events.h>
  23. #endif
  24.  
  25. #ifndef __FILES__
  26. #include <Files.h>
  27. #endif
  28.  
  29.  
  30. /* type for unique process identifier */
  31. struct ProcessSerialNumber {
  32.     unsigned long highLongOfPSN;
  33.     unsigned long lowLongOfPSN;
  34. };
  35.  
  36. typedef struct ProcessSerialNumber ProcessSerialNumber;
  37. typedef ProcessSerialNumber *ProcessSerialNumberPtr;
  38.  
  39.  
  40. enum {
  41.  
  42.  
  43. /*************************************************************************
  44.  *                            Process identifier.
  45.  ************************************************************************
  46.  Various reserved process serial numbers. */
  47.  
  48.     kNoProcess = 0,
  49.     kSystemProcess = 1,
  50.     kCurrentProcess = 2
  51. };
  52.  
  53. /**********************************************************************************************************************************************
  54.  *        Definition of the parameter block passed to _Launch.
  55.  *************************************************************************
  56.  
  57. * Typedef and flags for launchControlFlags field */
  58. typedef unsigned short LaunchFlags;
  59.  
  60. enum {
  61.  
  62.  
  63. /*************************************************************************
  64.  *        Definition of the parameter block passed to _Launch.
  65.  *************************************************************************/
  66.  
  67.     launchContinue = 0x4000,
  68.     launchNoFileFlags = 0x0800,
  69.     launchUseMinimum = 0x0400,
  70.     launchDontSwitch = 0x0200,
  71.     launchAllow24Bit = 0x0100,
  72.     launchInhibitDaemon = 0x0080
  73. };
  74.  
  75. /* Format for first AppleEvent to pass to new process.  The size of the overall
  76.  * buffer variable: the message body immediately follows the messageLength.
  77.  */
  78. struct AppParameters {
  79.     EventRecord theMsgEvent;
  80.     unsigned long eventRefCon;
  81.     unsigned long messageLength;
  82. };
  83.  
  84. typedef struct AppParameters AppParameters;
  85. typedef AppParameters *AppParametersPtr;
  86.  
  87. /* Parameter block to _Launch */
  88. struct LaunchParamBlockRec {
  89.     unsigned long reserved1;
  90.     unsigned short reserved2;
  91.     unsigned short launchBlockID;
  92.     unsigned long launchEPBLength;
  93.     unsigned short launchFileFlags;
  94.     LaunchFlags launchControlFlags;
  95.     FSSpecPtr launchAppSpec;
  96.     ProcessSerialNumber launchProcessSN;
  97.     unsigned long launchPreferredSize;
  98.     unsigned long launchMinimumSize;
  99.     unsigned long launchAvailableSize;
  100.     AppParametersPtr launchAppParameters;
  101. };
  102.  
  103. typedef struct LaunchParamBlockRec LaunchParamBlockRec;
  104. typedef LaunchParamBlockRec *LaunchPBPtr;
  105.  
  106.  
  107. enum {
  108.  
  109.  
  110. /* Set launchBlockID to extendedBlock to specify that extensions exist.
  111. * Set launchEPBLength to extendedBlockLen for compatibility.*/
  112.  
  113.  
  114. #define extendedBlock ((unsigned short)'LC')
  115. #define extendedBlockLen (sizeof(LaunchParamBlockRec) - 12)
  116.  
  117. /*************************************************************************
  118.  * Definition of the information block returned by GetProcessInformation
  119.  ************************************************************************
  120.  Bits in the processMode field */
  121.  
  122.  
  123.     modeDeskAccessory = 0x00020000,
  124.     modeMultiLaunch = 0x00010000,
  125.     modeNeedSuspendResume = 0x00004000,
  126.     modeCanBackground = 0x00001000,
  127.     modeDoesActivateOnFGSwitch = 0x00000800,
  128.     modeOnlyBackground = 0x00000400,
  129.     modeGetFrontClicks = 0x00000200,
  130.     modeGetAppDiedMsg = 0x00000100,
  131.     mode32BitCompatible = 0x00000080,
  132.     modeHighLevelEventAware = 0x00000040,
  133.     modeLocalAndRemoteHLEvents = 0x00000020,
  134.     modeStationeryAware = 0x00000010,
  135.     modeUseTextEditServices = 0x00000008
  136. };
  137.  
  138. /* Record returned by GetProcessInformation */
  139. struct ProcessInfoRec {
  140.     unsigned long processInfoLength;
  141.     StringPtr processName;
  142.     ProcessSerialNumber processNumber;
  143.     unsigned long processType;
  144.     OSType processSignature;
  145.     unsigned long processMode;
  146.     Ptr processLocation;
  147.     unsigned long processSize;
  148.     unsigned long processFreeMem;
  149.     ProcessSerialNumber processLauncher;
  150.     unsigned long processLaunchDate;
  151.     unsigned long processActiveTime;
  152.     FSSpecPtr processAppSpec;
  153. };
  154.  
  155. typedef struct ProcessInfoRec ProcessInfoRec;
  156. typedef ProcessInfoRec *ProcessInfoRecPtr;
  157.  
  158.  
  159. #ifdef __cplusplus
  160. extern "C" {
  161. #endif
  162. #pragma parameter __D0 LaunchApplication(__A0)
  163. pascal OSErr LaunchApplication(const LaunchParamBlockRec *LaunchParams)
  164.     = 0xA9F2; 
  165. pascal OSErr LaunchDeskAccessory(const FSSpec *pFileSpec,ConstStr255Param pDAName)
  166.     = {0x3F3C,0x0036,0xA88F}; 
  167. pascal OSErr GetCurrentProcess(ProcessSerialNumber *PSN)
  168.     = {0x3F3C,0x0037,0xA88F}; 
  169. pascal OSErr GetFrontProcess(ProcessSerialNumber *PSN)
  170.     = {0x70FF,0x2F00,0x3F3C,0x0039,0xA88F}; 
  171. pascal OSErr GetNextProcess(ProcessSerialNumber *PSN)
  172.     = {0x3F3C,0x0038,0xA88F}; 
  173. pascal OSErr GetProcessInformation(const ProcessSerialNumber *PSN,ProcessInfoRecPtr info)
  174.     = {0x3F3C,0x003A,0xA88F}; 
  175. pascal OSErr SetFrontProcess(const ProcessSerialNumber *PSN)
  176.     = {0x3F3C,0x003B,0xA88F}; 
  177. pascal OSErr WakeUpProcess(const ProcessSerialNumber *PSN)
  178.     = {0x3F3C,0x003C,0xA88F}; 
  179. pascal OSErr SameProcess(const ProcessSerialNumber *PSN1,const ProcessSerialNumber *PSN2,
  180.     Boolean *result)
  181.     = {0x3F3C,0x003D,0xA88F}; 
  182. #ifdef __cplusplus
  183. }
  184. #endif
  185.  
  186. #endif
  187.